package com.onewingu.gcs.server;

import com.onewingu.gcs.client.SessionService;
import com.google.gdata.client.http.AuthSubUtil;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class SessionServiceImpl extends RemoteServiceServlet implements
		SessionService {

	public String sessionServer(String input) throws IllegalArgumentException {
		String next = input + "index.html";
		String scope = "https://www.google.com/m8/feeds/";
		boolean secure = false;
		boolean session = true;
		String loginURL = AuthSubUtil.getRequestUrl(next, scope, secure, session);
		return loginURL;
	}

	public String getLoginURL(String input) throws IllegalArgumentException {
		String next = input + "index.html";
		String scope = "https://www.google.com/m8/feeds/";
		boolean secure = false;
		boolean session = true;
		String loginURL = AuthSubUtil.getRequestUrl(next, scope, secure, session);
		return loginURL;
	}
}
